<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Registration</title>
    </h:head>
    <h:body>
        <p:layout fullPage="true" >

            <p:layoutUnit position="center" >
                <h:form id="registrationform">

                    <p:panel header="Sign up" style="width: 400px; margin:auto">
                        <f:facet name="header">

                        </f:facet>
                        <h:panelGrid columns="3" id="regGrid" >

                            <h:outputLabel for="name">Name:</h:outputLabel>
                            <p:inputText id="name" value="#{registrationbean.user.name}" required="true">
                                <p:ajax update="namemsg"/>
                            </p:inputText>
                            <p:message id="namemsg" for="name" />

                            <h:outputLabel for="surname">Surname:</h:outputLabel>
                            <p:inputText id="surname" value="#{registrationbean.user.surname}" required="true">
                                <p:ajax update="surnamemsg"/>
                            </p:inputText>
                            <p:message id="surnamemsg" for="surname" />

                            <h:outputLabel for="email">Email:</h:outputLabel>
                            <p:inputText type="email" id="email" value="#{registrationbean.user.email}" required="true">
                                <p:ajax update="emailmsg"/>
                            </p:inputText>
                            <p:message id="emailmsg" for="email" />

                            <h:outputLabel for="birthDate">BirthDate:</h:outputLabel>

                            <p:calendar id="german" value="#{registrationbean.user.birthDate}" locale="it" navigator="true" pattern="dd-MM-yyyy" required="true">
                            </p:calendar>

                            <p:message id="birthDate" for="birthDate" />

                            <h:outputLabel for="username">Username:</h:outputLabel>
                            <p:inputText id="username" value="#{registrationbean.user.username}" required="true">
                                <p:ajax update="usernamemsg"/>
                            </p:inputText>
                            <p:message id="usernamemsg" for="username" />

                            <h:outputLabel for="password">Password:</h:outputLabel>
                            <p:password id="password" value="#{registrationbean.user.password}"
                                        feedback="true" match="pwd2" label="Password" required="true"/>
                            <p:message for="password" />

                            <h:outputLabel for="pwd2">Confirm Password:</h:outputLabel>
                            <p:password id="pwd2" label="Confirm Password"/>
                        </h:panelGrid>
                 
                            <p:commandButton id="submit" styleClass="login2" style="background: -webkit-linear-gradient(top, #00b7ea 0%,#009ec3 100%); border: double; border-color: black; border-width: 3px; color: black" value="Sign up"
                                         action="#{registrationbean.isRegistered()}" />
                        <p:button style="background: -webkit-linear-gradient(top, #00b7ea 0%,#009ec3 100%); border: double; border-color: black; border-width: 3px; color: black " outcome="login" value="Back"/>
                      
                    </p:panel>

                    

                </h:form>
            </p:layoutUnit>
        </p:layout>
    </h:body>
</html>

